<?php
class GoodProAction extends LoginAction
{
    public function index ()
    {
        $GoodProModel = M('GoodPro');
        $goodPro = $GoodProModel->select();
        if ($goodPro) {
            $this->assign('goodPro', $goodPro);
        }
        $this->display();
    }
    /**
     * 添加商品属性操作
     * @author Ice iceinto@mallog.com.cn
     */
    public function add ()
    {
        if (isPost()) {
            $this->createAdd('GoodPro');
        }
        $this->display();
    }
    /**
     * 修改商品属性操作
     * @author Ice iceinto@mallog.com.cn
     */
    public function edit ()
    {
        $goodPro = null;
        $id = (int) getGetOrPost('id');
        $GoodProModel = D('GoodPro');
        if ($id) {
            $map = array('id' => $id);
            $goodPro = $GoodProModel->getBaseData($map);
        }
        if (isPost() && isset($goodPro)) {
            $this->createUpdate('GoodPro');
            $goodPro = $GoodProModel->getBaseData($map);
        }
        if ($goodPro) {
            $this->assign('goodPro', $goodPro);
            $this->display();
        } else {
            $this->error('对应商品属性不存在！');
        }
    }
}
?>